package com.jeesite.modules.dataScreen.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Configuration
public class ThreadPoolConfig {


    @Bean("threadPoolExecutor")
    public ThreadPoolExecutor threadPoolExecutor() {
        int availableProcessors = Runtime.getRuntime().availableProcessors();
        return new ThreadPoolExecutor(availableProcessors * 2, availableProcessors * 3, 3, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
    }
}
